import cv2 as cv
import numpy as np

# 读取图像以及90度旋转图像
img = cv.imread(r'LENA.jpg')
img1 = np.rot90(img)

# 创建检测算子以及提取描述子
surf = cv.xfeatures2d.SURF_create(100)
kp1, dst1 = surf.detectAndCompute(img, None)
kp2, dst2 = surf.detectAndCompute(img1, None)

# BFMatcher类对象的创建
BF = cv.BFMatcher(cv.NORM_L1)
#描述子匹配
matches = BF.match(dst1, dst2)

#画出100个描述子匹配点
img2 = cv.drawMatches(img, kp1, img1, kp2, matches[:100], None, flags = 2)
# 显示图像
cv.imshow("img", img2)
cv.waitKey()
